{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 用户和活动关联关系处理\n",
    "\n",
    "\n",
    "整个数据集中活动数目（events.csv）太多，所以下面的处理我们找出只在训练集和测试集中出现的活动和用户集合，并对他们重新编制索引"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "#保存数据\n",
    "import pickle\n",
    "\n",
    "import itertools\n",
    "\n",
    "#处理事件字符串\n",
    "import datetime\n",
    "\n",
    "import numpy as np\n",
    "import scipy.io as sio\n",
    "import scipy.sparse as ss\n",
    "\n",
    "#相似度/距离\n",
    "import scipy.spatial.distance as ssd\n",
    "\n",
    "from collections import defaultdict\n",
    "from sklearn.preprocessing import normalize"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "number of uniqueUsers :3391\n",
      "number of uniqueEvents :13418\n"
     ]
    }
   ],
   "source": [
    " \"\"\"\n",
    "我们只关心train和test中出现的user和event，因此重点处理这部分关联数据\n",
    "\n",
    "train.csv 有6列：\n",
    "user：用户ID\n",
    "event：活动ID\n",
    "invited：是否被邀请（0/1）\n",
    "timestamp：ISO-8601 UTC格式时间字符串，表示用户看到该活动的时间\n",
    "interested, and not_interested\n",
    "\n",
    "Test.csv 除了没有interested, and not_interested，其余列与train相同\n",
    " \"\"\"\n",
    "    \n",
    "# 统计训练集中有多少不同的用户的events\n",
    "uniqueUsers = set()\n",
    "uniqueEvents = set()\n",
    "\n",
    "#倒排表\n",
    "#统计每个用户参加的活动   / 每个活动参加的用户\n",
    "eventsForUser = defaultdict(set)\n",
    "usersForEvent = defaultdict(set)\n",
    "    \n",
    "for filename in [\"train.csv\", \"test.csv\"]:\n",
    "    f = open(filename, 'rb')\n",
    "    \n",
    "    #忽略第一行（列名字）\n",
    "    f.readline().strip().decode().split(\",\")\n",
    "    \n",
    "    for line in f:    #对每条记录\n",
    "        cols = line.strip().decode().split(\",\")\n",
    "        uniqueUsers.add(cols[0])   #第一列为用户ID\n",
    "        uniqueEvents.add(cols[1])   #第二列为活动ID\n",
    "        \n",
    "        #eventsForUser[cols[0]].add(cols[1])    #该用户参加了这个活动\n",
    "        #usersForEvent[cols[1]].add(cols[0])    #该活动被用户参加\n",
    "    f.close()\n",
    "\n",
    "\n",
    "n_uniqueUsers = len(uniqueUsers)\n",
    "n_uniqueEvents = len(uniqueEvents)\n",
    "\n",
    "print(\"number of uniqueUsers :%d\" % n_uniqueUsers)\n",
    "print(\"number of uniqueEvents :%d\" % n_uniqueEvents)\n",
    "\n",
    "#用户关系矩阵表，可用于后续LFM/SVD++处理的输入\n",
    "#这是一个稀疏矩阵，记录用户对活动感兴趣\n",
    "userEventScores = ss.dok_matrix((n_uniqueUsers, n_uniqueEvents))\n",
    "userIndex = dict()\n",
    "eventIndex = dict()\n",
    "\n",
    "#重新编码用户索引字典\n",
    "for i, u in enumerate(uniqueUsers):\n",
    "    userIndex[u] = i\n",
    "    \n",
    "#重新编码活动索引字典    \n",
    "for i, e in enumerate(uniqueEvents):\n",
    "    eventIndex[e] = i\n",
    "\n",
    "n_records = 0\n",
    "ftrain = open(\"train.csv\", 'rb')\n",
    "ftrain.readline()\n",
    "for line in ftrain:\n",
    "    cols = line.strip().decode().split(\",\")\n",
    "    i = userIndex[cols[0]]  #用户\n",
    "    j = eventIndex[cols[1]] #活动\n",
    "    \n",
    "    eventsForUser[i].add(j)    #该用户参加了这个活动\n",
    "    usersForEvent[j].add(i)    #该活动被用户参加\n",
    "        \n",
    "    #userEventScores[i, j] = int(cols[4]) - int(cols[5])   #interested - not_interested\n",
    "    score = int(cols[4])\n",
    "    #if score == 0:  #0在稀疏矩阵中表示该元素不存在，因此借用-1表示interested=0\n",
    "    #userEventScores[i, j] = -1\n",
    "    #else:\n",
    "    userEventScores[i, j] = score\n",
    "ftrain.close()\n",
    "\n",
    "  \n",
    "##统计每个用户参加的活动，后续用于将用户朋友参加的活动影响到用户\n",
    "pickle.dump(eventsForUser, open(\"PE_eventsForUser.pkl\", 'wb'))\n",
    "##统计活动参加的用户\n",
    "pickle.dump(usersForEvent, open(\"PE_usersForEvent.pkl\", 'wb'))\n",
    "\n",
    "#保存用户-活动关系矩阵R，以备后用\n",
    "sio.mmwrite(\"PE_userEventScores\", userEventScores)\n",
    "\n",
    "\n",
    "#保存用户索引表\n",
    "pickle.dump(userIndex, open(\"PE_userIndex.pkl\", 'wb'))\n",
    "#保存活动索引表\n",
    "pickle.dump(eventIndex, open(\"PE_eventIndex.pkl\", 'wb'))\n",
    "\n",
    "    \n",
    "# 为了防止不必要的计算，我们找出来所有关联的用户 或者 关联的event\n",
    "# 所谓的关联用户，指的是至少在同一个event上有行为的用户pair\n",
    "# 关联的event指的是至少同一个user有行为的event pair\n",
    "uniqueUserPairs = set()\n",
    "uniqueEventPairs = set()\n",
    "for event in uniqueEvents:\n",
    "    i = eventIndex[event]\n",
    "    users = usersForEvent[i]\n",
    "    if len(users) > 2:\n",
    "        uniqueUserPairs.update(itertools.combinations(users, 2))\n",
    "        \n",
    "for user in uniqueUsers:\n",
    "    u = userIndex[user]\n",
    "    events = eventsForUser[u]\n",
    "    if len(events) > 2:\n",
    "        uniqueEventPairs.update(itertools.combinations(events, 2))\n",
    " \n",
    "#保存用户-事件关系对索引表\n",
    "pickle.dump(uniqueUserPairs, open(\"FE_uniqueUserPairs.pkl\", 'wb'))\n",
    "pickle.dump(uniqueEventPairs, open(\"PE_uniqueEventPairs.pkl\", 'wb'))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{'3681213459': 0,\n",
       " '3213485905': 1,\n",
       " '897667289': 2,\n",
       " '754337333': 3,\n",
       " '682010995': 4,\n",
       " '2488272785': 5,\n",
       " '602394192': 6,\n",
       " '3848300978': 7,\n",
       " '3751969407': 8,\n",
       " '1779231622': 9,\n",
       " '1093670500': 10,\n",
       " '519339673': 11,\n",
       " '864823067': 12,\n",
       " '743088347': 13,\n",
       " '1984807525': 14,\n",
       " '955692500': 15,\n",
       " '2447396369': 16,\n",
       " '2113532094': 17,\n",
       " '3478806116': 18,\n",
       " '1769873692': 19,\n",
       " '1218522841': 20,\n",
       " '43564092': 21,\n",
       " '473531767': 22,\n",
       " '2850127303': 23,\n",
       " '693206007': 24,\n",
       " '4011082942': 25,\n",
       " '2307482894': 26,\n",
       " '1066191630': 27,\n",
       " '880413067': 28,\n",
       " '1695480317': 29,\n",
       " '1445028465': 30,\n",
       " '2477400016': 31,\n",
       " '4116657168': 32,\n",
       " '2156780216': 33,\n",
       " '3809991219': 34,\n",
       " '3846588922': 35,\n",
       " '2422810156': 36,\n",
       " '3485089810': 37,\n",
       " '2473561029': 38,\n",
       " '3365728297': 39,\n",
       " '2135167144': 40,\n",
       " '1820083761': 41,\n",
       " '3840231238': 42,\n",
       " '2705316616': 43,\n",
       " '321086300': 44,\n",
       " '2610494844': 45,\n",
       " '1532094066': 46,\n",
       " '1513616494': 47,\n",
       " '4065675893': 48,\n",
       " '1288074648': 49,\n",
       " '2389231921': 50,\n",
       " '2922105732': 51,\n",
       " '3717332132': 52,\n",
       " '2036538169': 53,\n",
       " '2611754657': 54,\n",
       " '1296139548': 55,\n",
       " '3479915003': 56,\n",
       " '1583917689': 57,\n",
       " '2889501135': 58,\n",
       " '2305935776': 59,\n",
       " '312946086': 60,\n",
       " '238183057': 61,\n",
       " '2252745757': 62,\n",
       " '938161513': 63,\n",
       " '2178514388': 64,\n",
       " '812528842': 65,\n",
       " '1677917066': 66,\n",
       " '3883276816': 67,\n",
       " '2187372380': 68,\n",
       " '345960905': 69,\n",
       " '970700766': 70,\n",
       " '1093844070': 71,\n",
       " '193342496': 72,\n",
       " '2896575744': 73,\n",
       " '2415184013': 74,\n",
       " '2259216780': 75,\n",
       " '4179630573': 76,\n",
       " '728874447': 77,\n",
       " '1420231458': 78,\n",
       " '916138104': 79,\n",
       " '3897815885': 80,\n",
       " '604179853': 81,\n",
       " '137370544': 82,\n",
       " '4153011100': 83,\n",
       " '1530169810': 84,\n",
       " '3873822688': 85,\n",
       " '4216192606': 86,\n",
       " '3949409640': 87,\n",
       " '414601582': 88,\n",
       " '3971390766': 89,\n",
       " '1795009389': 90,\n",
       " '3861768249': 91,\n",
       " '838134604': 92,\n",
       " '298871218': 93,\n",
       " '1712704788': 94,\n",
       " '1407744396': 95,\n",
       " '2934010632': 96,\n",
       " '3190180184': 97,\n",
       " '4201565639': 98,\n",
       " '2768687948': 99,\n",
       " '2621889209': 100,\n",
       " '3608297024': 101,\n",
       " '1549888368': 102,\n",
       " '1134231092': 103,\n",
       " '2179267582': 104,\n",
       " '1968146304': 105,\n",
       " '491131434': 106,\n",
       " '949519938': 107,\n",
       " '1282392038': 108,\n",
       " '3669299967': 109,\n",
       " '4032059949': 110,\n",
       " '2811190711': 111,\n",
       " '869427005': 112,\n",
       " '1361307272': 113,\n",
       " '2490223551': 114,\n",
       " '3239024487': 115,\n",
       " '750931934': 116,\n",
       " '1591959024': 117,\n",
       " '1986416649': 118,\n",
       " '3529693138': 119,\n",
       " '4192471115': 120,\n",
       " '1888712494': 121,\n",
       " '1024681142': 122,\n",
       " '2518430453': 123,\n",
       " '1066839399': 124,\n",
       " '742383430': 125,\n",
       " '269461758': 126,\n",
       " '2747347526': 127,\n",
       " '3327788367': 128,\n",
       " '686618588': 129,\n",
       " '3382409058': 130,\n",
       " '1363545588': 131,\n",
       " '3095369567': 132,\n",
       " '1785099143': 133,\n",
       " '1396446223': 134,\n",
       " '670599422': 135,\n",
       " '3645292062': 136,\n",
       " '875529449': 137,\n",
       " '4057581717': 138,\n",
       " '579727844': 139,\n",
       " '345596616': 140,\n",
       " '4037098467': 141,\n",
       " '2130616732': 142,\n",
       " '4225120855': 143,\n",
       " '2333203361': 144,\n",
       " '2858842033': 145,\n",
       " '1986487861': 146,\n",
       " '310352532': 147,\n",
       " '1299206322': 148,\n",
       " '2894128040': 149,\n",
       " '1432188744': 150,\n",
       " '613668540': 151,\n",
       " '2152420806': 152,\n",
       " '3392885130': 153,\n",
       " '3834803264': 154,\n",
       " '318178573': 155,\n",
       " '2618739853': 156,\n",
       " '2092874032': 157,\n",
       " '3549638872': 158,\n",
       " '2264787329': 159,\n",
       " '617964033': 160,\n",
       " '3302882916': 161,\n",
       " '3179047450': 162,\n",
       " '361570611': 163,\n",
       " '3212455030': 164,\n",
       " '3427185275': 165,\n",
       " '657063613': 166,\n",
       " '1095401609': 167,\n",
       " '1587116147': 168,\n",
       " '2575352938': 169,\n",
       " '2601678976': 170,\n",
       " '3186998441': 171,\n",
       " '199858305': 172,\n",
       " '3113837197': 173,\n",
       " '305513883': 174,\n",
       " '443617544': 175,\n",
       " '1224985099': 176,\n",
       " '3398368733': 177,\n",
       " '254046741': 178,\n",
       " '475538891': 179,\n",
       " '660144483': 180,\n",
       " '3770815990': 181,\n",
       " '1426072738': 182,\n",
       " '2096658932': 183,\n",
       " '2264041858': 184,\n",
       " '1548231595': 185,\n",
       " '1828726073': 186,\n",
       " '239085097': 187,\n",
       " '1949729672': 188,\n",
       " '1232039292': 189,\n",
       " '3697176442': 190,\n",
       " '259997168': 191,\n",
       " '3275597979': 192,\n",
       " '3251813967': 193,\n",
       " '2806316076': 194,\n",
       " '2681949096': 195,\n",
       " '3503491290': 196,\n",
       " '1673895160': 197,\n",
       " '3364940341': 198,\n",
       " '3424643087': 199,\n",
       " '1466995652': 200,\n",
       " '1532377761': 201,\n",
       " '3773519709': 202,\n",
       " '473090869': 203,\n",
       " '2235916835': 204,\n",
       " '1765678116': 205,\n",
       " '3709772523': 206,\n",
       " '1091316601': 207,\n",
       " '3465260466': 208,\n",
       " '1063306856': 209,\n",
       " '3190231827': 210,\n",
       " '1708545365': 211,\n",
       " '804262283': 212,\n",
       " '1934335136': 213,\n",
       " '4160470528': 214,\n",
       " '2689622376': 215,\n",
       " '1096627389': 216,\n",
       " '3233419825': 217,\n",
       " '3943014604': 218,\n",
       " '1348764141': 219,\n",
       " '615449287': 220,\n",
       " '350511551': 221,\n",
       " '641209622': 222,\n",
       " '473110551': 223,\n",
       " '4044222914': 224,\n",
       " '2983198547': 225,\n",
       " '1401528678': 226,\n",
       " '886419721': 227,\n",
       " '1394487790': 228,\n",
       " '3466325304': 229,\n",
       " '280784670': 230,\n",
       " '3589430405': 231,\n",
       " '1660503085': 232,\n",
       " '4107771229': 233,\n",
       " '3651171375': 234,\n",
       " '966971643': 235,\n",
       " '2306764850': 236,\n",
       " '1496739876': 237,\n",
       " '3005685679': 238,\n",
       " '432466438': 239,\n",
       " '1180607121': 240,\n",
       " '1873976153': 241,\n",
       " '2978630628': 242,\n",
       " '2105385171': 243,\n",
       " '1760975014': 244,\n",
       " '1799996886': 245,\n",
       " '3924788609': 246,\n",
       " '3089404904': 247,\n",
       " '429380726': 248,\n",
       " '1622702915': 249,\n",
       " '4249979866': 250,\n",
       " '1800693034': 251,\n",
       " '4150025051': 252,\n",
       " '2670899462': 253,\n",
       " '3075394600': 254,\n",
       " '4025975316': 255,\n",
       " '3531892734': 256,\n",
       " '2359252504': 257,\n",
       " '423623928': 258,\n",
       " '324417384': 259,\n",
       " '1646922764': 260,\n",
       " '2689439975': 261,\n",
       " '2272220944': 262,\n",
       " '2692153353': 263,\n",
       " '369979069': 264,\n",
       " '2869069067': 265,\n",
       " '3084875554': 266,\n",
       " '3654485924': 267,\n",
       " '2324380948': 268,\n",
       " '4250174466': 269,\n",
       " '1058791332': 270,\n",
       " '1732259589': 271,\n",
       " '3180988532': 272,\n",
       " '107443528': 273,\n",
       " '944508163': 274,\n",
       " '3921231623': 275,\n",
       " '4229467350': 276,\n",
       " '542538548': 277,\n",
       " '1263459475': 278,\n",
       " '3265153806': 279,\n",
       " '3358028399': 280,\n",
       " '585101277': 281,\n",
       " '1430108025': 282,\n",
       " '1182519871': 283,\n",
       " '1859823732': 284,\n",
       " '2638434295': 285,\n",
       " '2554956824': 286,\n",
       " '3368006282': 287,\n",
       " '3179167671': 288,\n",
       " '1077926551': 289,\n",
       " '3725816644': 290,\n",
       " '86502595': 291,\n",
       " '2951987246': 292,\n",
       " '4147201367': 293,\n",
       " '570436992': 294,\n",
       " '1380103098': 295,\n",
       " '1996897474': 296,\n",
       " '1178225908': 297,\n",
       " '2082259770': 298,\n",
       " '2952666575': 299,\n",
       " '4112668226': 300,\n",
       " '2341662452': 301,\n",
       " '1927107595': 302,\n",
       " '2857665129': 303,\n",
       " '1140161058': 304,\n",
       " '3091734711': 305,\n",
       " '3966478016': 306,\n",
       " '3967878081': 307,\n",
       " '2829792984': 308,\n",
       " '2307150378': 309,\n",
       " '956986600': 310,\n",
       " '219382171': 311,\n",
       " '2020073928': 312,\n",
       " '3593566246': 313,\n",
       " '2717151070': 314,\n",
       " '29180020': 315,\n",
       " '1281707182': 316,\n",
       " '1569186701': 317,\n",
       " '1076082442': 318,\n",
       " '3504715371': 319,\n",
       " '2054614790': 320,\n",
       " '795973226': 321,\n",
       " '3129511797': 322,\n",
       " '85610883': 323,\n",
       " '1701929655': 324,\n",
       " '1533293110': 325,\n",
       " '2713137893': 326,\n",
       " '2045110309': 327,\n",
       " '672648599': 328,\n",
       " '872813215': 329,\n",
       " '330661817': 330,\n",
       " '1201195269': 331,\n",
       " '2166119628': 332,\n",
       " '2008322528': 333,\n",
       " '219854506': 334,\n",
       " '2630656108': 335,\n",
       " '1533609818': 336,\n",
       " '2680781138': 337,\n",
       " '3957104249': 338,\n",
       " '17874489': 339,\n",
       " '240779043': 340,\n",
       " '1199170498': 341,\n",
       " '3876697052': 342,\n",
       " '2613764281': 343,\n",
       " '2143251401': 344,\n",
       " '3926229879': 345,\n",
       " '1141674672': 346,\n",
       " '1249778557': 347,\n",
       " '3192244285': 348,\n",
       " '144722539': 349,\n",
       " '3547711454': 350,\n",
       " '4246197109': 351,\n",
       " '4166625784': 352,\n",
       " '1338752348': 353,\n",
       " '2650202363': 354,\n",
       " '3081148851': 355,\n",
       " '1029448353': 356,\n",
       " '2520824112': 357,\n",
       " '1387775604': 358,\n",
       " '379197377': 359,\n",
       " '3783800124': 360,\n",
       " '3780075220': 361,\n",
       " '204831554': 362,\n",
       " '2006433337': 363,\n",
       " '2023131804': 364,\n",
       " '1041260118': 365,\n",
       " '2389467513': 366,\n",
       " '1641436512': 367,\n",
       " '585151978': 368,\n",
       " '626269042': 369,\n",
       " '37626417': 370,\n",
       " '1381535648': 371,\n",
       " '1270937556': 372,\n",
       " '866903362': 373,\n",
       " '525603148': 374,\n",
       " '3440289078': 375,\n",
       " '3598931817': 376,\n",
       " '4180045053': 377,\n",
       " '2264207621': 378,\n",
       " '704244113': 379,\n",
       " '1117109340': 380,\n",
       " '1711316424': 381,\n",
       " '2178315774': 382,\n",
       " '2654661184': 383,\n",
       " '2150057383': 384,\n",
       " '2847152365': 385,\n",
       " '1008778548': 386,\n",
       " '1076018285': 387,\n",
       " '2554987616': 388,\n",
       " '1849550758': 389,\n",
       " '4106568158': 390,\n",
       " '3949816728': 391,\n",
       " '4030786582': 392,\n",
       " '1505861410': 393,\n",
       " '3287558640': 394,\n",
       " '12957499': 395,\n",
       " '2898331095': 396,\n",
       " '4170108374': 397,\n",
       " '2002156284': 398,\n",
       " '4276275266': 399,\n",
       " '494342684': 400,\n",
       " '1410302557': 401,\n",
       " '1406192615': 402,\n",
       " '278754212': 403,\n",
       " '3896860087': 404,\n",
       " '4129023810': 405,\n",
       " '2398136361': 406,\n",
       " '825378558': 407,\n",
       " '2213167316': 408,\n",
       " '2703345903': 409,\n",
       " '2173608003': 410,\n",
       " '3915796357': 411,\n",
       " '3321926072': 412,\n",
       " '4002607728': 413,\n",
       " '903020933': 414,\n",
       " '698908517': 415,\n",
       " '2217975107': 416,\n",
       " '1685778212': 417,\n",
       " '1811322299': 418,\n",
       " '2775611507': 419,\n",
       " '46008403': 420,\n",
       " '370451063': 421,\n",
       " '1967193107': 422,\n",
       " '4229337308': 423,\n",
       " '2586617318': 424,\n",
       " '282265232': 425,\n",
       " '2803416473': 426,\n",
       " '721082024': 427,\n",
       " '1343845939': 428,\n",
       " '3258819416': 429,\n",
       " '3342862156': 430,\n",
       " '1128274822': 431,\n",
       " '726662409': 432,\n",
       " '3088405938': 433,\n",
       " '1716470668': 434,\n",
       " '1255904420': 435,\n",
       " '3842575553': 436,\n",
       " '665321720': 437,\n",
       " '1397515488': 438,\n",
       " '1753679456': 439,\n",
       " '2384019439': 440,\n",
       " '3351643799': 441,\n",
       " '1217021374': 442,\n",
       " '2492433817': 443,\n",
       " '2285108120': 444,\n",
       " '1369355865': 445,\n",
       " '4235689748': 446,\n",
       " '1878997696': 447,\n",
       " '619118259': 448,\n",
       " '2806259041': 449,\n",
       " '1701047854': 450,\n",
       " '2724377242': 451,\n",
       " '2542056792': 452,\n",
       " '440970262': 453,\n",
       " '2494196199': 454,\n",
       " '483140053': 455,\n",
       " '828951442': 456,\n",
       " '1398858039': 457,\n",
       " '3583375355': 458,\n",
       " '1668072163': 459,\n",
       " '2675605891': 460,\n",
       " '1868823319': 461,\n",
       " '783839520': 462,\n",
       " '1467610412': 463,\n",
       " '2246974842': 464,\n",
       " '532732480': 465,\n",
       " '1999674603': 466,\n",
       " '2150848115': 467,\n",
       " '2397682512': 468,\n",
       " '3626895603': 469,\n",
       " '4135207140': 470,\n",
       " '2870889809': 471,\n",
       " '3389631138': 472,\n",
       " '3685386977': 473,\n",
       " '1068082883': 474,\n",
       " '713755727': 475,\n",
       " '2803335863': 476,\n",
       " '2891200198': 477,\n",
       " '866329141': 478,\n",
       " '2980178978': 479,\n",
       " '2851625619': 480,\n",
       " '1343107637': 481,\n",
       " '1612428848': 482,\n",
       " '1440583414': 483,\n",
       " '1960789592': 484,\n",
       " '904937903': 485,\n",
       " '668426704': 486,\n",
       " '2727714216': 487,\n",
       " '1701861494': 488,\n",
       " '530014408': 489,\n",
       " '3709226646': 490,\n",
       " '2923256494': 491,\n",
       " '168005957': 492,\n",
       " '4040372452': 493,\n",
       " '570094895': 494,\n",
       " '177193417': 495,\n",
       " '1834011436': 496,\n",
       " '2237304267': 497,\n",
       " '3669510320': 498,\n",
       " '4274310707': 499,\n",
       " '1853069366': 500,\n",
       " '2773966086': 501,\n",
       " '3624273144': 502,\n",
       " '3313954564': 503,\n",
       " '587454424': 504,\n",
       " '2839190693': 505,\n",
       " '485696274': 506,\n",
       " '2138641915': 507,\n",
       " '3187773396': 508,\n",
       " '3312755383': 509,\n",
       " '4009259776': 510,\n",
       " '2471550700': 511,\n",
       " '3448037031': 512,\n",
       " '4270139223': 513,\n",
       " '2422316321': 514,\n",
       " '3570341326': 515,\n",
       " '2439597708': 516,\n",
       " '555703577': 517,\n",
       " '3860040039': 518,\n",
       " '2133473801': 519,\n",
       " '1203331926': 520,\n",
       " '3270933059': 521,\n",
       " '1089038689': 522,\n",
       " '1795371268': 523,\n",
       " '3459643094': 524,\n",
       " '2683913641': 525,\n",
       " '2800586555': 526,\n",
       " '1060275544': 527,\n",
       " '2488253729': 528,\n",
       " '902747271': 529,\n",
       " '1939550439': 530,\n",
       " '3946692042': 531,\n",
       " '3590775294': 532,\n",
       " '3048394832': 533,\n",
       " '2330046225': 534,\n",
       " '2685878625': 535,\n",
       " '1966266774': 536,\n",
       " '1700688767': 537,\n",
       " '25927492': 538,\n",
       " '731713663': 539,\n",
       " '939064991': 540,\n",
       " '2528255053': 541,\n",
       " '2731345509': 542,\n",
       " '1373625192': 543,\n",
       " '1516890542': 544,\n",
       " '2904863529': 545,\n",
       " '2272129750': 546,\n",
       " '702971420': 547,\n",
       " '979051762': 548,\n",
       " '2851440006': 549,\n",
       " '762464570': 550,\n",
       " '214089778': 551,\n",
       " '2793561755': 552,\n",
       " '493246293': 553,\n",
       " '1840858294': 554,\n",
       " '667779361': 555,\n",
       " '4054253362': 556,\n",
       " '2322876084': 557,\n",
       " '4243588081': 558,\n",
       " '3703162437': 559,\n",
       " '675692005': 560,\n",
       " '1959421009': 561,\n",
       " '3029325544': 562,\n",
       " '2057354451': 563,\n",
       " '375657807': 564,\n",
       " '3311667000': 565,\n",
       " '2447943335': 566,\n",
       " '3305677128': 567,\n",
       " '2628690308': 568,\n",
       " '380338457': 569,\n",
       " '3726239046': 570,\n",
       " '546889678': 571,\n",
       " '2392886869': 572,\n",
       " '2795993128': 573,\n",
       " '1930033127': 574,\n",
       " '3551855555': 575,\n",
       " '3608285664': 576,\n",
       " '737396264': 577,\n",
       " '2937515293': 578,\n",
       " '2489574463': 579,\n",
       " '547383999': 580,\n",
       " '3926115451': 581,\n",
       " '1206835239': 582,\n",
       " '839969661': 583,\n",
       " '4034045801': 584,\n",
       " '19341280': 585,\n",
       " '35305848': 586,\n",
       " '666781614': 587,\n",
       " '2378521366': 588,\n",
       " '1042540981': 589,\n",
       " '2679177159': 590,\n",
       " '1567855402': 591,\n",
       " '401574569': 592,\n",
       " '2413462956': 593,\n",
       " '2391815688': 594,\n",
       " '2081128662': 595,\n",
       " '2850509209': 596,\n",
       " '489688963': 597,\n",
       " '2940200534': 598,\n",
       " '950236593': 599,\n",
       " '494609171': 600,\n",
       " '1344630617': 601,\n",
       " '3487833744': 602,\n",
       " '74229557': 603,\n",
       " '3261946380': 604,\n",
       " '1277547362': 605,\n",
       " '2989916614': 606,\n",
       " '3100757952': 607,\n",
       " '832277631': 608,\n",
       " '1487572967': 609,\n",
       " '3439842241': 610,\n",
       " '2265531116': 611,\n",
       " '2361063319': 612,\n",
       " '2980765180': 613,\n",
       " '585557076': 614,\n",
       " '4257314703': 615,\n",
       " '3083345340': 616,\n",
       " '507118096': 617,\n",
       " '1596190412': 618,\n",
       " '4212324250': 619,\n",
       " '111483358': 620,\n",
       " '2466263946': 621,\n",
       " '3234297562': 622,\n",
       " '605208919': 623,\n",
       " '2628680570': 624,\n",
       " '2915789051': 625,\n",
       " '1413641706': 626,\n",
       " '3503466480': 627,\n",
       " '1040771467': 628,\n",
       " '2254372858': 629,\n",
       " '3018427739': 630,\n",
       " '1732452113': 631,\n",
       " '1765289049': 632,\n",
       " '3376050735': 633,\n",
       " '792632006': 634,\n",
       " '3652898890': 635,\n",
       " '3073190206': 636,\n",
       " '518815654': 637,\n",
       " '914532885': 638,\n",
       " '994310148': 639,\n",
       " '4114296702': 640,\n",
       " '2367196896': 641,\n",
       " '110700006': 642,\n",
       " '3643346333': 643,\n",
       " '1386404286': 644,\n",
       " '1282082433': 645,\n",
       " '3161340282': 646,\n",
       " '33770938': 647,\n",
       " '553002810': 648,\n",
       " '2755327289': 649,\n",
       " '1374817425': 650,\n",
       " '449812514': 651,\n",
       " '1124054232': 652,\n",
       " '991427858': 653,\n",
       " '156790944': 654,\n",
       " '514005507': 655,\n",
       " '4194031651': 656,\n",
       " '2776566965': 657,\n",
       " '2315973008': 658,\n",
       " '2458488006': 659,\n",
       " '293450268': 660,\n",
       " '1602457910': 661,\n",
       " '813240354': 662,\n",
       " '2985774237': 663,\n",
       " '1983888102': 664,\n",
       " '2951460111': 665,\n",
       " '12241688': 666,\n",
       " '3686258067': 667,\n",
       " '2400372017': 668,\n",
       " '2332683796': 669,\n",
       " '422504591': 670,\n",
       " '3912782817': 671,\n",
       " '1203705291': 672,\n",
       " '689417931': 673,\n",
       " '2423655062': 674,\n",
       " '3179355340': 675,\n",
       " '2533424446': 676,\n",
       " '2009824063': 677,\n",
       " '1852859019': 678,\n",
       " '1889909673': 679,\n",
       " '4085032789': 680,\n",
       " '3171087633': 681,\n",
       " '2506160720': 682,\n",
       " '3847455245': 683,\n",
       " '1942387906': 684,\n",
       " '3411275264': 685,\n",
       " '3799675359': 686,\n",
       " '3465367492': 687,\n",
       " '2980258101': 688,\n",
       " '3311128071': 689,\n",
       " '4039875661': 690,\n",
       " '3002938758': 691,\n",
       " '2739960670': 692,\n",
       " '3414181314': 693,\n",
       " '911059261': 694,\n",
       " '1625043970': 695,\n",
       " '3156836239': 696,\n",
       " '3123256869': 697,\n",
       " '2990906610': 698,\n",
       " '2625791867': 699,\n",
       " '3887437420': 700,\n",
       " '2209057061': 701,\n",
       " '3311537362': 702,\n",
       " '1870423168': 703,\n",
       " '3120842736': 704,\n",
       " '1521958638': 705,\n",
       " '3547653054': 706,\n",
       " '3370398075': 707,\n",
       " '3281762985': 708,\n",
       " '919637696': 709,\n",
       " '2793309582': 710,\n",
       " '1036990545': 711,\n",
       " '940258698': 712,\n",
       " '3172060382': 713,\n",
       " '3077019139': 714,\n",
       " '1198319209': 715,\n",
       " '2403141666': 716,\n",
       " '371151062': 717,\n",
       " '618783038': 718,\n",
       " '2352794406': 719,\n",
       " '1071245956': 720,\n",
       " '352751137': 721,\n",
       " '626740748': 722,\n",
       " '3457399351': 723,\n",
       " '2324717272': 724,\n",
       " '3971808383': 725,\n",
       " '3462134235': 726,\n",
       " '2407779614': 727,\n",
       " '3863081535': 728,\n",
       " '3873677722': 729,\n",
       " '2124851829': 730,\n",
       " '915347945': 731,\n",
       " '2187417502': 732,\n",
       " '2362894171': 733,\n",
       " '306290176': 734,\n",
       " '530788794': 735,\n",
       " '23065304': 736,\n",
       " '559618821': 737,\n",
       " '2074898020': 738,\n",
       " '543299546': 739,\n",
       " '1790004322': 740,\n",
       " '1810485930': 741,\n",
       " '1548928340': 742,\n",
       " '2665081210': 743,\n",
       " '1133147752': 744,\n",
       " '3188180104': 745,\n",
       " '2867164384': 746,\n",
       " '4199168774': 747,\n",
       " '1355698802': 748,\n",
       " '673980216': 749,\n",
       " '3287069160': 750,\n",
       " '2763545469': 751,\n",
       " '3764710330': 752,\n",
       " '2690882078': 753,\n",
       " '3614645299': 754,\n",
       " '1647929068': 755,\n",
       " '1770523304': 756,\n",
       " '1073827062': 757,\n",
       " '86565862': 758,\n",
       " '150342414': 759,\n",
       " '3841472085': 760,\n",
       " '2953583082': 761,\n",
       " '1527128646': 762,\n",
       " '1652798666': 763,\n",
       " '303750199': 764,\n",
       " '2052212736': 765,\n",
       " '2649026611': 766,\n",
       " '3247862990': 767,\n",
       " '890543862': 768,\n",
       " '2424116559': 769,\n",
       " '528216257': 770,\n",
       " '2511965806': 771,\n",
       " '896333395': 772,\n",
       " '4108853194': 773,\n",
       " '554561877': 774,\n",
       " '2522610844': 775,\n",
       " '604068853': 776,\n",
       " '839136936': 777,\n",
       " '2466666653': 778,\n",
       " '3921048124': 779,\n",
       " '3477624372': 780,\n",
       " '1193925467': 781,\n",
       " '3416874251': 782,\n",
       " '3088888923': 783,\n",
       " '3229872217': 784,\n",
       " '2491530958': 785,\n",
       " '2761317427': 786,\n",
       " '636178997': 787,\n",
       " '2715282469': 788,\n",
       " '3054551380': 789,\n",
       " '1379282099': 790,\n",
       " '445373500': 791,\n",
       " '1080582769': 792,\n",
       " '4142334594': 793,\n",
       " '2761765714': 794,\n",
       " '3698756265': 795,\n",
       " '203534201': 796,\n",
       " '25062233': 797,\n",
       " '1691794213': 798,\n",
       " '2942284757': 799,\n",
       " '1678145610': 800,\n",
       " '3403877450': 801,\n",
       " '292829502': 802,\n",
       " '1049718981': 803,\n",
       " '3696948957': 804,\n",
       " '3345209952': 805,\n",
       " '1985254914': 806,\n",
       " '1271330281': 807,\n",
       " '504450213': 808,\n",
       " '3396588531': 809,\n",
       " '2936557254': 810,\n",
       " '926605391': 811,\n",
       " '627290679': 812,\n",
       " '1600849184': 813,\n",
       " '4179487847': 814,\n",
       " '3451398154': 815,\n",
       " '4208685267': 816,\n",
       " '1733435510': 817,\n",
       " '1892861718': 818,\n",
       " '1824334392': 819,\n",
       " '4106338184': 820,\n",
       " '4000859550': 821,\n",
       " '334013045': 822,\n",
       " '2458710999': 823,\n",
       " '593744182': 824,\n",
       " '1722968298': 825,\n",
       " '1050017180': 826,\n",
       " '1875856704': 827,\n",
       " '1406993074': 828,\n",
       " '2435374903': 829,\n",
       " '4199917972': 830,\n",
       " '928532134': 831,\n",
       " '3505158996': 832,\n",
       " '2012870396': 833,\n",
       " '656688286': 834,\n",
       " '438462512': 835,\n",
       " '1379273008': 836,\n",
       " '3123645626': 837,\n",
       " '1684415115': 838,\n",
       " '2615804415': 839,\n",
       " '2354407405': 840,\n",
       " '3531332626': 841,\n",
       " '3428029430': 842,\n",
       " '738643299': 843,\n",
       " '1130876022': 844,\n",
       " '1381992714': 845,\n",
       " '464565286': 846,\n",
       " '3352427003': 847,\n",
       " '706344711': 848,\n",
       " '1733366362': 849,\n",
       " '1210420727': 850,\n",
       " '123333167': 851,\n",
       " '3755997215': 852,\n",
       " '1982879066': 853,\n",
       " '1718780095': 854,\n",
       " '2695866169': 855,\n",
       " '2964650855': 856,\n",
       " '1920873214': 857,\n",
       " '2996923495': 858,\n",
       " '738942203': 859,\n",
       " '2599698872': 860,\n",
       " '2098456340': 861,\n",
       " '3476820940': 862,\n",
       " '4197279783': 863,\n",
       " '1883700806': 864,\n",
       " '186216354': 865,\n",
       " '1051419581': 866,\n",
       " '4208608073': 867,\n",
       " '1338321138': 868,\n",
       " '2829598154': 869,\n",
       " '1089819483': 870,\n",
       " '363096366': 871,\n",
       " '634388536': 872,\n",
       " '1510609207': 873,\n",
       " '990120316': 874,\n",
       " '2118368309': 875,\n",
       " '416605749': 876,\n",
       " '3556644095': 877,\n",
       " '2768548410': 878,\n",
       " '1031025754': 879,\n",
       " '2409266493': 880,\n",
       " '2147803764': 881,\n",
       " '2977769484': 882,\n",
       " '1775404950': 883,\n",
       " '2470001152': 884,\n",
       " '2808705599': 885,\n",
       " '3812153136': 886,\n",
       " '150733034': 887,\n",
       " '1265003645': 888,\n",
       " '2569103422': 889,\n",
       " '1775237825': 890,\n",
       " '1822028766': 891,\n",
       " '3770158409': 892,\n",
       " '2132445355': 893,\n",
       " '1918177304': 894,\n",
       " '2802832059': 895,\n",
       " '1791598205': 896,\n",
       " '1508535164': 897,\n",
       " '376593949': 898,\n",
       " '3928966388': 899,\n",
       " '3461255917': 900,\n",
       " '1207717800': 901,\n",
       " '3123265999': 902,\n",
       " '3339581566': 903,\n",
       " '172445691': 904,\n",
       " '2345395514': 905,\n",
       " '2062854199': 906,\n",
       " '376720958': 907,\n",
       " '3751924386': 908,\n",
       " '2419496401': 909,\n",
       " '4137702889': 910,\n",
       " '543117146': 911,\n",
       " '3206644772': 912,\n",
       " '1992961977': 913,\n",
       " '968373357': 914,\n",
       " '438305330': 915,\n",
       " '1942474082': 916,\n",
       " '2824762134': 917,\n",
       " '3147493880': 918,\n",
       " '1996047693': 919,\n",
       " '1123107265': 920,\n",
       " '1205391785': 921,\n",
       " '2867445361': 922,\n",
       " '3364485916': 923,\n",
       " '493515244': 924,\n",
       " '945439689': 925,\n",
       " '401222554': 926,\n",
       " '2794778207': 927,\n",
       " '2287755049': 928,\n",
       " '3477077952': 929,\n",
       " '1991938600': 930,\n",
       " '404595428': 931,\n",
       " '497536928': 932,\n",
       " '772318802': 933,\n",
       " '876577108': 934,\n",
       " '198166767': 935,\n",
       " '2485387516': 936,\n",
       " '49312682': 937,\n",
       " '3975178736': 938,\n",
       " '4290470709': 939,\n",
       " '2173876437': 940,\n",
       " '832412932': 941,\n",
       " '3581435589': 942,\n",
       " '196924436': 943,\n",
       " '1170318717': 944,\n",
       " '1319886393': 945,\n",
       " '2251316725': 946,\n",
       " '1328316936': 947,\n",
       " '1963580118': 948,\n",
       " '732997628': 949,\n",
       " '1692430260': 950,\n",
       " '3126487334': 951,\n",
       " '1275755916': 952,\n",
       " '3444116390': 953,\n",
       " '3065441109': 954,\n",
       " '1373058755': 955,\n",
       " '3201100159': 956,\n",
       " '246499579': 957,\n",
       " '4125204455': 958,\n",
       " '3023628065': 959,\n",
       " '4198698180': 960,\n",
       " '2494424409': 961,\n",
       " '2628408888': 962,\n",
       " '3266414126': 963,\n",
       " '3221372597': 964,\n",
       " '1781691537': 965,\n",
       " '3698848785': 966,\n",
       " '3601961332': 967,\n",
       " '322567970': 968,\n",
       " '2269626530': 969,\n",
       " '2288419571': 970,\n",
       " '899668139': 971,\n",
       " '1290210464': 972,\n",
       " '3968395368': 973,\n",
       " '3653009977': 974,\n",
       " '2024782884': 975,\n",
       " '3018427137': 976,\n",
       " '3858223520': 977,\n",
       " '1215962379': 978,\n",
       " '1278199678': 979,\n",
       " '144836311': 980,\n",
       " '4125754193': 981,\n",
       " '2859654056': 982,\n",
       " '155693996': 983,\n",
       " '1429589754': 984,\n",
       " '3324867589': 985,\n",
       " '2904980609': 986,\n",
       " '3292387762': 987,\n",
       " '2954869825': 988,\n",
       " '2444401672': 989,\n",
       " '2141096032': 990,\n",
       " '4206665392': 991,\n",
       " '2714036762': 992,\n",
       " '3501931364': 993,\n",
       " '4268934123': 994,\n",
       " '739610511': 995,\n",
       " '102460414': 996,\n",
       " '317875697': 997,\n",
       " '3428003058': 998,\n",
       " '1779648453': 999,\n",
       " ...}"
      ]
     },
     "execution_count": 24,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "eventIndex"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.4"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
